import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PayOrderDetailVO, PayOrderDetailForm, PayOrderDetailQuery } from '@/api/goods/payOrderDetail/types';

/**
 * 查询续费单明细列表
 * @param query
 * @returns {*}
 */

export const listPayOrderDetail = (query?: PayOrderDetailQuery): AxiosPromise<PayOrderDetailVO[]> => {
  return request({
    url: '/order/payOrderDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询我的审核续费单明细列表
 * @param query
 * @returns {*}
 */

export const listPayOrderDetailAudit = (query?: PayOrderDetailQuery): AxiosPromise<PayOrderDetailVO[]> => {
  return request({
    url: '/order/payOrderDetail/myAuditList',
    method: 'get',
    params: query
  });
};
/**
 * 查询续费单历史明细列表
 * @param query
 * @returns {*}
 */

export const listPayOrderHistoryDetail = (query?: PayOrderDetailQuery): AxiosPromise<PayOrderDetailVO[]> => {
  return request({
    url: '/order/payOrderDetail/queryHistoryList',
    method: 'get',
    params: query
  });
};
/**
 * 查询续费单明细详细
 * @param id
 */
export const getPayOrderDetail = (id: string | number): AxiosPromise<PayOrderDetailVO> => {
  return request({
    url: '/order/payOrderDetail/' + id,
    method: 'get'
  });
};

/**
 * 新增续费单明细
 * @param data
 */
export const addPayOrderDetail = (data: PayOrderDetailForm) => {
  return request({
    url: '/order/payOrderDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改续费单明细
 * @param data
 */
export const updatePayOrderDetail = (data: PayOrderDetailForm) => {
  return request({
    url: '/order/payOrderDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除续费单明细
 * @param id
 */
export const delPayOrderDetail = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/payOrderDetail/' + id,
    method: 'delete'
  });
};

export default {
  list: listPayOrderDetail,
  auditList: listPayOrderDetailAudit,
  get: getPayOrderDetail,
  add: addPayOrderDetail,
  update: updatePayOrderDetail,
  del: delPayOrderDetail
}